import {
	WeaTools
} from 'ecCom'

/**
 * 获取权限
 * @param  {[type]} moduleName [模块名]
 * @param  {Object} params     [description]
 * @return {[type]}            [description]
 */
export const authorized = (moduleName, params = {}, apiMethod = 'getHasRight') => WeaTools.callApi(`/api/${moduleName}/${apiMethod}`, 'POST', params);

/**
 * 应用分权
 */
export const detachable = (params = {}) => WeaTools.callApi('/api/hrm/common/getDetachable', 'GET', params);

export const checkAuthAndDetach = (moduleName, params = {}, apiMethod = 'getHasRight') => Promise.all([authorized(moduleName, params, apiMethod || 'getHasRight'), detachable()])

export const exportExcel = (params = {}) => WeaTools.callApi('/api/ec/dev/table/export', 'POST', params)

export const isEnableMultiLang = (params = {}) => WeaTools.callApi('/api/hrm/common/isEnableMultiLang', 'GET', params)

export const getPinYin = (params = {}) => WeaTools.callApi('/api/workflow/formSetting/fieldSet/getPinYin', 'POST', params)